package com.example.demo.service;

import java.util.List;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.example.demo.entity.Teacher;
import com.example.demo.repository.TeacherRepository;

@Service
public class TeacherService {

	@Resource
	private TeacherRepository teacherRepository;
	
	@Transactional
	public Teacher add(Teacher teacher) {
		return teacherRepository.save(teacher);
	}
	
	@Transactional
	public List<Teacher> add(Iterable<Teacher> teachers) {
		return teacherRepository.save(teachers);
	}
	
}
